package cn.t.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;

import java.util.Date;

@Data
public class MqttMessageDTO<T> {
    /**
     * 消息类型
     */
    @JsonProperty("msg_type")
    private String msgType;
    /**
     * 消息id
     */
    @JsonProperty("msg_id")
    private String msgId;
    /**
     * 推送时间
     */
    @JsonProperty("push_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS", timezone="Asia/Shanghai")
    private Date pushTime = new Date();
    /**
     * 消息内容
     */
    private T data;

    public MqttMessageDTO(String msgType, String msgId, T data) {
        this.msgType = msgType;
        this.msgId = msgId;
        this.data = data;
    }
}
